package com.iflytek.iot.common.model;

import java.util.List;
import java.util.Map;

/**
 * 验证结果
 * @author yusun4 2020/10/30
 */
public class ValidateResult<T> {

    /**
     * The source object tobe validated.
     */
    private T source;

    /**
     * 是否成功
     */
    private boolean success;

    /**
     * 字段验证错误信息
     */
    private List<Map<String,Object>> propertyErrors;

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public List<Map<String, Object>> getPropertyErrors() {
        return propertyErrors;
    }

    public void setPropertyErrors(List<Map<String, Object>> propertyErrors) {
        this.propertyErrors = propertyErrors;
    }

    public T getSource() {
        return source;
    }

    public void setSource(T source) {
        this.source = source;
    }

    @Override
    public String toString() {
        return "{\"ValidateResult\":{"
                + "\"source\":"
                + source
                + ",\"success\":"
                + success
                + ",\"propertyErrors\":"
                + propertyErrors
                + "}}";

    }
}
